package com.heima.user.controller.v1;

import com.heima.common.constants.user.UserRelationConstants;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.UserRelationDTO;
import com.heima.model.user.pojos.ApUser;
import com.heima.user.service.ApUserRelationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.ZSetOperations;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

@Api(value = "用户关注API",tags = "用户关注API")
@RestController
@RequestMapping("/api/v1/user")
public class UserRelationController  {
    @Autowired
    ApUserRelationService apUserRelationService;
    @ApiOperation("关注 或 取关")
    @PostMapping("/user_follow")
    public ResponseResult follow(@RequestBody UserRelationDTO dto){
        return apUserRelationService.follow(dto);
    }


    @ApiOperation("查找所有粉丝")
    @PostMapping("/fans_list")
    public ResponseResult loadList(@RequestParam Integer apUserId) {

        return apUserRelationService.loadList(apUserId);
    }
}